// 按需导入
import { Loginservice } from "@/utils/request.js";
import md5 from "js-md5";
// 获取用户详细信息
export function reqGetUserInfo(data) {
  return Loginservice({
    // url: '/UserConfig/GetUserInfo',
    url: '/UserConfig/GetUserInfo2',
    method: 'post',
    data
  })
}

// 获取权限角色列表1
export function reqGetRoleList() {
  return Loginservice({
    // url: '/UserConfig/GetRoleList',
    url: '/UserConfig/GetRoleList2',
    method: 'post',
    data: {
      SystemName,
    }
  })
}


// 根据UID获取信息
export function reqGetUserInfoByUID(UID) {
  return Loginservice({
    // url: '/UserConfig/GetUserInfoByUID',
    url: '/UserConfig/GetUserInfoByUID2',
    method: 'post',
    data: {
      SystemName,
      UID
    }
  })
}

// 新增
export function reqAddUserInfo(Info, OperateUser) {
  return Loginservice({
    url: '/UserConfig/AddUserInfo2',
    method: 'post',
    data: {
      Info,
      OperateUser
    }
  })
}

// 修改
export function reqUpdateUserInfo(Info, OperateUser) {
  return Loginservice({
    // url: '/UserConfig/UpdateUserInfo',
    url: '/UserConfig/UpdateUserInfo2',
    method: 'post',
    data: {
      Info,
      OperateUser,
    }
  })
}

// 重置密码
export function reqResetPwdUserInfo(UID, pwd, OperateUser) {
  return Loginservice({
    url: '/UserConfig/ResetPwdUserInfo',
    method: 'post',
    data: {
      UID,
      pwd,
      OperateUser
    }
  })
}

// 删除1
export function reqDeleteUserInfo1(Uids, OperateUser) {
  return Loginservice({
    url: '/UserConfig/DeleteUserInfo',
    method: 'post',
    data: {
      Uids,
      OperateUser,
      SystemName
    }
  })
}
// 删除2
export function reqDeleteUserInfo2(Uids, OperateUser) {
  return Loginservice({
    // url: '/UserConfig/DeleteUserInfo',
    url: '/UserConfig/DeleteUserInfo2',
    method: 'post',
    data: {
      Uids,
      OperateUser,
      SystemName
    }
  })
}

// 修改密码
export function reqChangeUserPWD(from, OperateUser) {
  var data = {
    oldPWD: md5(from.oldPWD),
    newPWD: md5(from.newPWD),
    OperateUser
  }
  return Loginservice({
    url: '/UserConfig/ChangeUserPWD',
    method: 'post',
    data
  })
}


// 获取APPDB 权限表
export function reqGetAPPDBRoleInfo() {
  return Loginservice({
    url: '/UserConfig/GetAPPDBRoleInfo',
    method: 'post',
    data: {}
  })
}

// 新增 APPDB 权限表
export function reqAddAPPDBRoleInfo(Info, OperateUser) {
  return Loginservice({
    url: '/UserConfig/AddAPPDBRoleInfo',
    method: 'post',
    data: {
      Info,
      OperateUser
    }
  })
}


// 系统列表
export function reqGetSystemList() {
  return Loginservice({
    url: '/UserConfig/GetSystemList',
    method: 'post',
    data: {}
  })
}

export function reqGetSystemRoles(SystemName) {
  return Loginservice({
    url: '/UserConfig/GetSystemRoles',
    method: 'post',
    data: {
      SystemName
    }
  })
}

export function reqUpdateSysPerValue(UID, SysPerValue) {
  return Loginservice({
    url: '/UserConfig/UpdateSysPerValue',
    method: 'post',
    data: {
      UID,
      SysPerValue
    }
  })
}
